package org.testis.testdriver;


/**
 * A concrete class of the Factory Design Pattern for driving in 
 * Debugging mode.
 * @author barisergun
 */
public class DebuggingDriver extends ExecutionDriver
{

    public DebuggingDriver()
    {
    }


    @Override
    public boolean drive(TestPart curTestPart,
                         TestIterator innerIt) throws InterruptedException
    {

        boolean testPartResult;
        testPartResult =
            curTestPart.run(AtofEnumaration.DebuggingMode.Debugging);


        if (curTestPart instanceof StepContainer) {

            driveCommon(curTestPart,
                        innerIt,
                        testPartResult);


        }

        return testPartResult;
    }


    @Override
    public boolean validate(TestPart curTestCase,
                            TestIterator inner)
    {
        boolean testPartResult;
        boolean setCaseResult = false;
        testPartResult = curTestCase.getTestPartResult();

        if (curTestCase instanceof StepContainer) {

            setCaseResult = validateCommon(curTestCase,
                                           inner,
                                           testPartResult);
        }

        return setCaseResult;
    }
}
